home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tchk050.arc / DATEHK.H < prev    next >
C/C++ Source or Header  |  1988-11-19  |  2KB  |  34 lines

  1. /* TCHK 0.50 - Howard Kapustein's Turbo C library     11-18-87 */
  2. /* Copyright (C) 1987, Howard Kapustein.  All rights reserved. */
  3.  
  4. /* datehk.h  -  header file for DATEHK.C - date routines */
  5.  
  6. #include <howard.h>
  7.  
  8. #ifndef BASE_LEAP_YEAR
  9. typedef enum { Sun, Mon, Tues, Wed, Thrus, Fri, Sat } days;
  10. typedef enum { Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec } months;
  11. typedef struct ddate {
  12.             int dyear;             /* Year - 1900 */
  13.             int dday;              /* Day of month (1-31) */
  14.             months dmon;      /* Month (Jan = 0) */
  15.         };
  16. #define DATENULL        "  -  -  "
  17. #define DATECHAR        '-'
  18. #define DATECHARSTR     "-"
  19. #define BASE_LEAP_YEAR  1980
  20. #endif
  21.  
  22.  
  23. /* function prototypes */
  24. boolean valid_date(int month, int day, int yearnum);  /* check if a date is valid */
  25. boolean isleapyear(int checkyear);          /* is checkyear a leap year */
  26. struct ddate *strtoddate(char *source);     /* convert a string to struct */
  27. char *ddatetostr(struct ddate *source);     /* convert struct to a string */
  28. char *ddatetolong(struct ddate *source);    /* convert struct to a full english string */
  29. char *ddatetoshort(struct ddate *source);   /* convert struct to a short english string */
  30. char *monthexpand(int month);               /* convert # to month name */
  31. int dayofyear(struct ddate *d);    /* calc day # of year (1-365) */
  32. int daysleft(struct ddate *d);     /* calc # days left in year (0-365) */
  33. long int diffddate(struct ddate *start, struct ddate *fini);  /* calc fini - start, in days */
  34.